import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// vue3插件配置
import AutoImport from 'unplugin-auto-import/vite'
//加载路径，配置全局@使用
import { resolve } from "path";
const pathResolve = (dir) => resolve(__dirname, dir);




export default defineConfig({
  plugins: [
    vue(),
    // 添加vue3插件
    AutoImport({
      imports: ['vue', 'vue-router']
    })
  ],
  resolve: {
    //设置路径别名
    alias: {
      "@": pathResolve("./src"), // 新增
    },
  },
  //设置跨域
  server: {
    proxy: {
      '/api': {
        target: 'https://www.talkxj.com/api',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      }
    }
  }
})
